<!-- 问大家 -->
<template>
	<view class="page_box">
		<view class="content_box">
			<view class="area-box">
				<textarea class="inp-area" v-model="message" placeholder=" " placeholder-class="pl-style" />
			</view>
			
			<view class="toAsk" @click="getAsk">提交</view>
			
		</view>
	</view>
</template>

<script>

export default {
	components: {
		
	},
	data() {
		return {
			isEmpty: false,
			typeCurrent: 'all',
			askList: [],
			loadStatus: 'loadmore', //loadmore-加载前的状态，loading-加载中的状态，nomore-没有更多的状态
			currentPage: 1,
			lastPage: 1,
			id:0,
			message:'',
		};
	},
	computed: {},
	onLoad(e) {
		let that = this;
		that.id=e.goodsId;
	},
	methods: {
		// 商品评论
		getAsk() {
			let that = this;
			let loadData = [];
			loadData['goodsId']=that.id;
			that.$http('goods.askAdd', {
				goods_id: that.id,
				message: that.message,
			}, '加载中...').then(res => {
				if (res.code === 1) {
					that.$u.toast('提问成功');
					//把数据返回给上一个页面
					let pages = getCurrentPages();
					let beforePage = pages[pages.length - 2]; //上一页页面实例
					if (typeof(beforePage) == "undefined") {
					    //没上一页面
					    return;
					}
					setTimeout(()=>
					    uni.navigateBack({
					        success: function() {
					            beforePage.onLoad(loadData); // 执行上一页的onLoad方法
					        }
					    })
					,100)
				}
			});
		},
		
	}
};
</script>

<style lang="scss">
	.page_box{
		background-color:#fff;
		min-height: 100%;
		padding-top: 20rpx;
		padding-bottom: 170rpx;
	}
.empty-box {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}
.head_box {
	height: 114rpx;
	background-color:#bebebe;
	padding: 0 20rpx;
	.type-btn {
		width: 130rpx;
		line-height: 62rpx;
		background: rgba(238, 238, 238, 1);
		border-radius: 31rpx;
		border: none;
		font-size: 28rpx;

		font-weight: 400;
		color: rgba(153, 153, 153, 1);
		padding: 0;
		margin-right: 10rpx;
	}
	.btn-active {
		background: linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1));
		box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
		color: #444;
	}
}
.comment-list {
	margin-top: 20rpx;
}
//问大家
.ask-div{
	color: #444;
	margin: 41rpx 25rpx 25rpx 25rpx;
	.ask-head{
		display:flex;
		justify-content: space-between;
		font-size: 29rpx;
	}
	.ask-value{
		background-color:#bebebe;
		margin: 12rpx 0 12rpx 0;
		padding: 10rpx 27rpx 10rpx 14rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		image{
			width: 42rpx;
			height: 42rpx;
			margin-right: 20rpx;
		}
		.ask-title{
			display: flex;
			align-items: center;
			font-size: 28rpx;
		}
		.ask-num{
			font-size: 17rpx;
		}
	}
}
.ask-div2{
	color: #444;
	margin-left: 20rpx;
	font-size: 22rpx;
	.ask-value2{
		background-color:#bebebe;
		margin-bottom: 10rpx;
		padding: 10rpx;
	}
}
.area-box{
	background-color:#ececec;
	margin: 30rpx;
	border-radius: 20rpx;
	padding: 30rpx;
	.inp-area{
					
	}
}
.toAsk{
  height: 70rpx;width: 50%;position: fixed;bottom: 0;z-index: 2;
  background-color:#bebebe;color: #444;text-align: center;border-radius: 20rpx;
  margin: 0 auto 70rpx 25%;padding-top: 10rpx;
}
</style>
